public class T {



    static  int count=0;
    

    public static void main(String[] args) throws InterruptedException {
        Thread thread = Thread.currentThread();
        Thread thread1=new Thread(()->{
            
          for(int i=0;i<50000;i++){



              synchronized (thread){
                  count++;

              }


            }

            System.out.println(thread.getState());

        },"thread1");

        Thread thread2=new Thread(()->{
            for(int i=0;i<50000;i++){


                synchronized (thread){
                    count++;

                }





            }
        },"thread2");



        thread1.start();
        thread2.start();

        System.out.println(thread2.getState());
        System.out.println(thread1.getState());

        thread1.join();


        thread2.join();


        System.out.println(count);


    }


}
